import request from '@/utils/request'
import { Pagination } from '@/types/global';

// 参数数据
export interface AppConfigData {
  id?: number;
  name: string;
  data?: string;
}

// 查询参数
export interface AppConfigParams extends Partial<AppConfigData> {
  current?: number;
  size?: number;
  startDate?: string;
  endDate?: string;
}

// 应用配置列表
export function pageAppConfig(params: AppConfigParams) {
  return request<Pagination<AppConfigData[]>>('get', '/sys/app-config/page', { params })
}

// 应用配置详情
export function getAppConfig(name: string) {
  return request<any>('get', '/sys/app-config/' + name)
}

// 新增应用配置
export function saveAppConfig(data: AppConfigData) {
  return request('post', '/sys/app-config', data)
}

// 修改应用配置
export function updateAppConfig(data: AppConfigData) {
  return request('put', '/sys/app-config', data)
}

// 删除应用配置
export function deleteAppConfig(ids: any) {
  return request('delete', '/sys/app-config/' + ids)
}
